package com.my.mvpdemo.mvp2.view;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.my.mvpdemo.mvp2.presenter.BasePresenter;


/**
 * Created by 张英杰 on 2017/2/22.
 */

public abstract class BaseActivity<V,T extends BasePresenter<V>> extends AppCompatActivity {
    protected T girlPresenter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        girlPresenter = createPresenter();
        girlPresenter.attachView((V)this);
    }

    protected abstract T createPresenter();

    @Override
    protected void onDestroy() {
        super.onDestroy();
        girlPresenter.detachView();
    }
}
